package fr.afcepf.atod16.groupe1.projet1.entities.catalogue;

import fr.afcepf.atod16.groupe1.projet1.entities.Entite;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * L'entité TVA
 * @author cedric
 */
@Entity
@Table(name = "tvas")
public class TVA implements Serializable, Entite {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name="id")
    private Integer id;
    @Column(name="taux", nullable = false)
    private Integer taux;

    public TVA() {
    }

    public TVA(Integer id, Integer taux) {
        this.id = id;
        this.taux = taux;
    }

    @Override
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getTaux() {
        return taux;
    }

    public void setTaux(Integer taux) {
        this.taux = taux;
    }

    @Override
    public String toString() {
        return "TVA [id=" + id + ", taux=" + taux + "]";
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((id == null) ? 0 : id.hashCode());
        result = prime * result + ((taux == null) ? 0 : taux.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        TVA other = (TVA) obj;
        if (id == null) {
            if (other.id != null) {
                return false;
            }
        } else if (!id.equals(other.id)) {
            return false;
        }
        if (taux == null) {
            if (other.taux != null) {
                return false;
            }
        } else if (!taux.equals(other.taux)) {
            return false;
        }
        return true;
    }
}
